﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class CellManager : MonoBehaviour
{
    public Text Name;

    public Image Head;

    [HideInInspector]
    public string name;

    [HideInInspector]
    public Sprite head;

    public Button button;

    bool IsOK;

    public bool IsNext = false;

    void Start()
    {
        Name.text = name;
        Head.sprite = head;
        button.onClick.AddListener(delegate
        {
            if (IsNext)
            {
                GameObject.Find("GameManager").GetComponent<Guide>().Next();
            }
            if (!IsOK)
            {
                GameObject.Find("GameManager").GetComponent<NPCManager>().Talks(name);
                IsOK = true;
            }
            GameObject.Find("GameManager").GetComponent<NPCManager>().Find(name);
            GameObject.Find("GameManager").GetComponent<NPCManager>().Clear(GameObject.Find("GameManager").GetComponent<NPCManager>().a);
        });
    }

}
